import { createRouter, createWebHistory } from 'vue-router'

import Login from '@/views/Login.vue'
import Home from '@/views/Home.vue'
import MapHome from '@/views/DisasterMonitor/Map.vue'
import Device from "@/views/DisasterMonitor/Device.vue";
import PipeGallery from "@/views/CityPipe/PipeGallery.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      children:[
          //灾害检测路由
        {
          path: "/",
          name: "disaster",
          children:[
            {
              path: "/",
              name: "map",
              component: MapHome
            },
            {
              path: "/disaster/device",
              name: "device",
              component: Device
            }
          ]
        },
        //城市管廊路由
        {
          path: "/cityPipe",
          name: "citypipe",
          children:[
            {
              path: "/cityPipe",
              name: "pipeGallery",
              component: PipeGallery
            },
          ]
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path:"/:catchAl(.*)",
      redirect: '/disaster'
    }
  ]
})

export default router
